$(function() {
    var $form =$(".form-myt-chart-report-def-dynamic");

    
    
    $form.submit(function(event) {
       /* var $voucher = $('input[name="voucher"]', this);
        var voucher = $voucher.val();
        if (voucher != '') {
            var url = WEB_ROOT + "/myt/sale/sale-delivery!pickingDetails?voucher=" + voucher;
            $(".div-sale-delivery-picking-details").ajaxGetUrl(url)
        }*/
        var searchDate = $('input[name="searchDate"]', this).val();
        var beginDate=searchDate.split("～")[0].trim();
        var endDate=searchDate.split("～")[1].trim();
        var fileName=$("select[name='fileName']").val()
        alert(beginDate+","+endDate+","+fileName);
        var url = WEB_ROOT + "/rpt/jasper-report!preview?format=XLS&report="+fileName+"&contentDisposition=attachment";
        url += "&reportParameters['P_DATE_BEGIN']=" + beginDate;
        url += "&reportParameters['P_DATE_END']=" + endDate;
        window.open(url, "_blank");
        event.preventDefault();
        event.stopPropagation();
        return false;
    })
});